//
//  BuyView.m
//  小团购
//
//  Created by 樊荣海 on 15/2/3.
//  Copyright (c) 2015年 樊荣海. All rights reserved.
//

#import "BuyView.h"

@implementation BuyView

+ (id)buyView {
    
    return [[NSBundle mainBundle] loadNibNamed:@"BuyView" owner:nil options:nil][0];
}

- (void)setDealModel:(DealModel *)dealModel {

    _dealModel = dealModel;
    
    _listPrice.text = [NSString stringWithFormat:@"%@元", _dealModel.list_price_text];
    _currentPrice.text = [NSString stringWithFormat:@"%@元",_dealModel.current_price_text];
    
    //重置frame
    CGSize size =  [LabelTool sizeOfStr:_currentPrice.text andFont:_currentPrice.font andMaxSize:CGSizeMake(120, 60) andLineBreakMode:NSLineBreakByTruncatingTail];

    CGRect rect = _currentPrice.frame;
    rect.size.width = size.width;
    _currentPrice.frame = rect;
    
    CGRect rect2 = _listPrice.frame;
    rect2.origin.x = CGRectGetMaxX(_currentPrice.frame) + 10;//稍微有点间距
    _listPrice.frame = rect2;
    
}

- (void)drawRect:(CGRect)rect
{
    [[UIImage resizedImage:@"bg_buyBtn.png"] drawInRect:rect];
}

@end
